<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<script>
			// 函数的参数传递
			// function printInfo1(){
			// 	console.log("why");
			// 	console.log(18);
			// 	console.log(1.88)
			// }
			
			// function printInfo2(){
			// 	console.log("kobe");
			// 	console.log(40);
			// 	console.log(1.87)
			// }
			
			// function printInfo1(){
			// 	console.log("james");
			// 	console.log(35);
			// 	console.log(1.86)
			// }
			
			// printInfo1();
			// printInfo2();
			// printInfo3();
			
			// 2.上面的代码进行重构
			// name, age, height: 形参
			function printInfo(name, age, height){
				console.log(name);
				console.log(age);
				console.log(height);
			}
			
			// "why", 18, 1.88: 实参
			printInfo("why", 18, 1.88);
			printInfo("kobe", 40, 1.87);
			printInfo("james", 35, 1.86);
			
			// 3.练习二:定义两个数字相加
			function sum(num1, num2){
				var result = num1 + num2;
				console.log(result);
			}
			
			sum(10, 20);
			sum(34, 66);
			
			// 4.练习三:对某个人say Hello
			function sayHello(name){
				console.log("Hello " + name);
				console.log("Hello", name);
			}
			
			// 5.练习四:为某个朋友唱生日歌
			function singSong(name){
				console.log("Happy Birthday To You");
				console.log("Happy Birthday To You");
				console.log("Happy Birthday To " + name);
				console.log("Happy Birthday To You");
			}
			
			sayHello("Kobe");
			singSong("James");
			
		</script>
	</body>
</html>
